﻿using System.Data;
using Malu.Entity;
using MaLu.Interfaces;
using System;


namespace MaLu.Data.SqlServer {
    public sealed class SqlInputDataFileLog : IInputDataFileLog
    {


        public void Insert(IDbProvider provider, InputDataFileLog log)
        {
            IDataParameter[] paras = null;
            string sql = SqlHelper.Instance.CreateInsertSql(log, out paras);
            SqlHelper.Instance.ExecuteNonQuery(provider, sql, paras);
        }
        public InputDataFileLog Get(IDbProvider provider, int id)
        {
            string sql = string.Format("select * from [InputDataFileLog] where [id]={0}", id);
            using (IDataReader dr = SqlHelper.Instance.ExecuteDataReader(provider, sql))
            {
                return SqlHelper.Instance.ConvertToEntity<InputDataFileLog>(dr);
            }
        }
    }
}
